<script language="javascript" src="{{$s_path}}/ueditor/ueditor.config.js"></script>
<script language="javascript" src="{{$s_path}}/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{{$s_path}}/ueditor/lang/zh-cn/zh-cn.js"></script>
 <form method="post" action="admins.php?act={{$act}}"  name="article_form">
<article class="module width_full" id="article_add">
    <header>
      <h3>新增文章</h3>
    </header>
    
    <div class="module_content">
   
      <fieldset>
        <label>标题</label>
        <input type="text" name="title">
      </fieldset>
      <fieldset>
       
        <textarea rows="12" name="content" id="content" style="height:300px"></textarea>
        <script>
		
          UE.getEditor('content');
        </script>
      </fieldset>
      <fieldset style="width:48%; float:left; margin-right: 3%;">
        <!-- to make two field float next to one another, adjust values accordingly -->
        <label>分类</label>
        <select style="width:92%;" name="cat_id">
          <option value="">请选择</option>
          {{foreach from=$cat_list item=list key=key}}
          <option value="{{$list.cat_id}}" {{if $list.cat_id==$cat_id}} selected="selected"{{/if}}>{{$list.cat_name}}</option>
          	 {{foreach from=$list.children item=s_list key=s_key}}
         	 <option value="{{$s_list.cat_id}}" {{if $s_list.cat_id==$cat_id}} selected="selected"{{/if}}>┗{{$s_list.cat_name}}</option>
          	{{/foreach}}
          {{/foreach}}
        
        </select>
      </fieldset>
    <!--  <fieldset style="width:48%; float:left;">
      
        <label>作者</label>
        <input type="text" style="width:92%" name="author">
      </fieldset>
      <fieldset style="width:48%; float:left;;margin-right: 3%;">
      
        <label>keywords</label>
        <input type="text" style="width:92%;" name="keywords">
      </fieldset>
      <fieldset style="width:48%; float:left;">
      
        <label>description</label>
        <input type="text" style="width:92%;" name="description">
      </fieldset>
      <fieldset style="width:48%; float:left;">
     
        <label>关联商品ID</label>
        <input type="text" style="width:92%;">
      </fieldset>-->
      <div class="clear"></div>
    </div>
    <footer>
      <div class="submit_link">
        <select name="is_open">
          <option value="1">是否显示?</option>
          <option value="1">是</option>
          <option value="0">否</option>
        </select>
        <input type="hidden" name="cat_id" value="{{$cat_id}}">
        <input type="submit" value="发布" class="alt_btn" onclick="return AD.articleAdd('#article_add')">
       </div>
    </footer>
  </article>
</form>
<script>
//增加文章
Admin.prototype.articleAdd = function(obj){
	var names = ['title','keywords','description','is_open','author','cat_id'];
	var data = Main.dataValue(obj,names);
	
	
	if(data.title && data.cat_id)
	{
		$("form[name=article_form]").submit();
	}
	else
	{
		alert("标题，分类 不能为空！");	
		return false;
	}
}

</script>